package test.service;

import java.util.ArrayList;

import org.junit.Assert;
import org.junit.Test;

import service.AssociationService;
import service.UnionAssociationService;
import entity.Employee;
import entity.Union;
import entity.UnionDue;

public class AssociationServiceTestCost {

	@Test
	public void test() {
		//test the cost 
		Employee employee=new Employee();
		Union association=new Union(10);
		employee.setAssociation(association);
		AssociationService service=new UnionAssociationService(employee,null);
		UnionDue unionDue1=new UnionDue(null, 100, association);
		UnionDue unionDue2=new UnionDue(null, 200, association);
		UnionDue unionDue3=new UnionDue(null, 300, association);
		association.setUnionDues(new ArrayList<UnionDue>());
		association.getUnionDues().add(unionDue1);
		association.getUnionDues().add(unionDue2);
		association.getUnionDues().add(unionDue3);
		float tot=association.getUnion_tax()+unionDue1.getAmount()+unionDue2.getAmount()+unionDue3.getAmount();
		Assert.assertEquals("The cost is ",tot,service.CalcCosts(),0);
	}

}
